home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / AIncludes / MachineExceptions.a < prev    next >
Encoding:
Text File  |  1998-08-17  |  6.9 KB  |  215 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        MachineExceptions.a
  3. ;
  4. ;    Contains:    Processor Exception Handling Interfaces.
  5. ;
  6. ;    Version:    Technology:    Mac OS 8
  7. ;                Release:    Universal Interfaces 3.2
  8. ;
  9. ;    Copyright:    © 1993-1998 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        For bug reports, consult the following page on
  12. ;                the World Wide Web:
  13. ;
  14. ;                    http://developer.apple.com/bugreporter/
  15. ;
  16. ;
  17.     IF &TYPE('__MACHINEEXCEPTIONS__') = 'UNDEFINED' THEN
  18. __MACHINEEXCEPTIONS__ SET 1
  19.  
  20.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  21.     include 'MacTypes.a'
  22.     ENDIF
  23.  
  24. ;  Some basic declarations used throughout the kernel 
  25.  
  26.  
  27.     IF TARGET_OS_MAC THEN
  28. ;  Machine Dependent types for PowerPC: 
  29. MachineInformationPowerPC RECORD 0
  30. CTR                         ds        UnsignedWide    ; offset: $0 (0)
  31. LR                         ds        UnsignedWide    ; offset: $8 (8)
  32. PC                         ds        UnsignedWide    ; offset: $10 (16)
  33. CR                         ds.l    1                ; offset: $18 (24)
  34. XER                         ds.l    1                ; offset: $1C (28)
  35. MSR                         ds.l    1                ; offset: $20 (32)
  36. MQ                         ds.l    1                ; offset: $24 (36)
  37. ExceptKind                 ds.l    1                ; offset: $28 (40)
  38. DSISR                     ds.l    1                ; offset: $2C (44)
  39. DAR                         ds        UnsignedWide    ; offset: $30 (48)
  40. Reserved                 ds        UnsignedWide    ; offset: $38 (56)
  41. sizeof                     EQU *                    ; size:   $40 (64)
  42.                         ENDR
  43. RegisterInformationPowerPC RECORD 0
  44. R0                         ds        UnsignedWide    ; offset: $0 (0)
  45. R1                         ds        UnsignedWide    ; offset: $8 (8)
  46. R2                         ds        UnsignedWide    ; offset: $10 (16)
  47. R3                         ds        UnsignedWide    ; offset: $18 (24)
  48. R4                         ds        UnsignedWide    ; offset: $20 (32)
  49. R5                         ds        UnsignedWide    ; offset: $28 (40)
  50. R6                         ds        UnsignedWide    ; offset: $30 (48)
  51. R7                         ds        UnsignedWide    ; offset: $38 (56)
  52. R8                         ds        UnsignedWide    ; offset: $40 (64)
  53. R9                         ds        UnsignedWide    ; offset: $48 (72)
  54. R10                         ds        UnsignedWide    ; offset: $50 (80)
  55. R11                         ds        UnsignedWide    ; offset: $58 (88)
  56. R12                         ds        UnsignedWide    ; offset: $60 (96)
  57. R13                         ds        UnsignedWide    ; offset: $68 (104)
  58. R14                         ds        UnsignedWide    ; offset: $70 (112)
  59. R15                         ds        UnsignedWide    ; offset: $78 (120)
  60. R16                         ds        UnsignedWide    ; offset: $80 (128)
  61. R17                         ds        UnsignedWide    ; offset: $88 (136)
  62. R18                         ds        UnsignedWide    ; offset: $90 (144)
  63. R19                         ds        UnsignedWide    ; offset: $98 (152)
  64. R20                         ds        UnsignedWide    ; offset: $A0 (160)
  65. R21                         ds        UnsignedWide    ; offset: $A8 (168)
  66. R22                         ds        UnsignedWide    ; offset: $B0 (176)
  67. R23                         ds        UnsignedWide    ; offset: $B8 (184)
  68. R24                         ds        UnsignedWide    ; offset: $C0 (192)
  69. R25                         ds        UnsignedWide    ; offset: $C8 (200)
  70. R26                         ds        UnsignedWide    ; offset: $D0 (208)
  71. R27                         ds        UnsignedWide    ; offset: $D8 (216)
  72. R28                         ds        UnsignedWide    ; offset: $E0 (224)
  73. R29                         ds        UnsignedWide    ; offset: $E8 (232)
  74. R30                         ds        UnsignedWide    ; offset: $F0 (240)
  75. R31                         ds        UnsignedWide    ; offset: $F8 (248)
  76. sizeof                     EQU *                    ; size:   $100 (256)
  77.                         ENDR
  78. FPUInformationPowerPC    RECORD 0
  79. Registers                 ds.b    32 * UnsignedWide.sizeof ; offset: $0 (0)
  80. FPSCR                     ds.l    1                ; offset: $100 (256)
  81. Reserved                 ds.l    1                ; offset: $104 (260)
  82. sizeof                     EQU *                    ; size:   $108 (264)
  83.                         ENDR
  84. Vector128                RECORD 0
  85. l                         ds.l    4                ; offset: $0 (0)
  86.                          ORG 0
  87. s                         ds.w    8                ; offset: $0 (0)
  88.                          ORG 0
  89. c                         ds.b    16                ; offset: $0 (0)
  90. sizeof                     EQU *                    ; size:   $10 (16)
  91.                         ENDR
  92. VectorInformationPowerPC RECORD 0
  93. Registers                 ds.b    32 * Vector128.sizeof ; offset: $0 (0)
  94. VSCR                     ds        Vector128        ; offset: $200 (512)
  95. VRsave                     ds.l    1                ; offset: $210 (528)
  96. sizeof                     EQU *                    ; size:   $214 (532)
  97.                         ENDR
  98. ;  Exception related declarations 
  99.  
  100. kWriteReference                    EQU        0
  101. kReadReference                    EQU        1
  102. kFetchReference                    EQU        2
  103. writeReference                    EQU        0                    ; Obsolete name
  104. readReference                    EQU        1                    ; Obsolete name
  105. fetchReference                    EQU        2                    ; Obsolete name
  106. ; typedef unsigned long                 MemoryReferenceKind
  107.  
  108. MemoryExceptionInformation RECORD 0
  109. theArea                     ds.l    1                ; offset: $0 (0)
  110. theAddress                 ds.l    1                ; offset: $4 (4)
  111. theError                 ds.l    1                ; offset: $8 (8)
  112. theReference             ds.l    1                ; offset: $C (12)
  113. sizeof                     EQU *                    ; size:   $10 (16)
  114.                         ENDR
  115.  
  116. kUnknownException                EQU        0
  117. kIllegalInstructionException    EQU        1
  118. kTrapException                    EQU        2
  119. kAccessException                EQU        3
  120. kUnmappedMemoryException        EQU        4
  121. kExcludedMemoryException        EQU        5
  122. kReadOnlyMemoryException        EQU        6
  123. kUnresolvablePageFaultException    EQU        7
  124. kPrivilegeViolationException    EQU        8
  125. kTraceException                    EQU        9
  126. kInstructionBreakpointException    EQU        10
  127. kDataBreakpointException        EQU        11
  128. kIntegerException                EQU        12
  129. kFloatingPointException            EQU        13
  130. kStackOverflowException            EQU        14
  131. kTaskTerminationException        EQU        15
  132. kTaskCreationException            EQU        16
  133.     IF OLDROUTINENAMES THEN
  134.  
  135. unknownException                EQU        0                    ; Obsolete name
  136. illegalInstructionException        EQU        1                    ; Obsolete name
  137. trapException                    EQU        2                    ; Obsolete name
  138. accessException                    EQU        3                    ; Obsolete name
  139. unmappedMemoryException            EQU        4                    ; Obsolete name
  140. excludedMemoryException            EQU        5                    ; Obsolete name
  141. readOnlyMemoryException            EQU        6                    ; Obsolete name
  142. unresolvablePageFaultException    EQU        7                    ; Obsolete name
  143. privilegeViolationException        EQU        8                    ; Obsolete name
  144. traceException                    EQU        9                    ; Obsolete name
  145. instructionBreakpointException    EQU        10                    ; Obsolete name
  146. dataBreakpointException            EQU        11                    ; Obsolete name
  147. integerException                EQU        12                    ; Obsolete name
  148. floatingPointException            EQU        13                    ; Obsolete name
  149. stackOverflowException            EQU        14                    ; Obsolete name
  150. terminationException            EQU        15                    ; Obsolete name
  151. kTerminationException            EQU        15                    ; Obsolete name
  152.     ENDIF    ; OLDROUTINENAMES
  153. ; typedef unsigned long                 ExceptionKind
  154.  
  155. ExceptionInfo            RECORD 0
  156. memoryInfo                 ds.l    1                ; offset: $0 (0)
  157. sizeof                     EQU *                    ; size:   $4 (4)
  158.                         ENDR
  159. ExceptionInformationPowerPC RECORD 0
  160. theKind                     ds.l    1                ; offset: $0 (0)
  161. machineState             ds.l    1                ; offset: $4 (4)
  162. registerImage             ds.l    1                ; offset: $8 (8)
  163. FPUImage                 ds.l    1                ; offset: $C (12)
  164. info                     ds        ExceptionInfo    ; offset: $10 (16)
  165. vectorImage                 ds.l    1                ; offset: $14 (20)
  166. sizeof                     EQU *                    ; size:   $18 (24)
  167.                         ENDR
  168. ExceptionInformation    RECORD 0
  169. f                         ds        ExceptionInformationPowerPC
  170. sizeof                     EQU *                    ; size:   $18 (24)
  171.                         ENDR
  172.  
  173.  
  174. MachineInformation        RECORD 0
  175. f                         ds        MachineInformationPowerPC
  176. sizeof                     EQU *                    ; size:   $40 (64)
  177.                         ENDR
  178.  
  179.  
  180. RegisterInformation        RECORD 0
  181. f                         ds        RegisterInformationPowerPC
  182. sizeof                     EQU *                    ; size:   $100 (256)
  183.                         ENDR
  184.  
  185.  
  186. FPUInformation            RECORD 0
  187. f                         ds        FPUInformationPowerPC
  188. sizeof                     EQU *                    ; size:   $108 (264)
  189.                         ENDR
  190.  
  191.  
  192. VectorInformation        RECORD 0
  193. f                         ds        VectorInformationPowerPC
  194. sizeof                     EQU *                    ; size:   $214 (532)
  195.                         ENDR
  196.  
  197.  
  198. ;  
  199. ;    Note:    An ExceptionHandler is NOT a UniversalProcPtr.
  200. ;            It must be a PowerPC function pointer with NO routine descriptor. 
  201. ;
  202.  
  203. ;  Routine for installing per-process exception handlers 
  204. ;
  205. ; pascal ExceptionHandler InstallExceptionHandler(ExceptionHandler theHandler)
  206. ;
  207.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  208.         IMPORT_CFM_FUNCTION InstallExceptionHandler
  209.     ENDIF
  210.  
  211.     ENDIF    ; TARGET_OS_MAC
  212.  
  213.     ENDIF ; __MACHINEEXCEPTIONS__ 
  214.  
  215.